package com.android.music.prolyric;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.IntentService;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.android.music.prolyric.search.SearchLyric;

public class LoadListSongOnline extends IntentService
{
	
	public LoadListSongOnline() 
	{
		super("");
	}
	

	public LoadListSongOnline(String name) 
	{
		super(name);		
	}

	@Override
	protected void onHandleIntent(Intent intent) {

		String[] lyric = null;
		ArrayList<HashMap<String, String>> arrayList = null;
		SearchLyric search = new SearchLyric();
		String songname = intent.getExtras().getString("songname"); 
		Intent broadcastIntent = new Intent();
		broadcastIntent.setAction("lOAD_SONG_FROM_WEB");
		Bundle b = new Bundle();
		if(songname!=null)
		{
			try 
			{
				arrayList = search.getAllData(songname);
				b.putSerializable("songlist", arrayList);
				Log.d("tim bai hat tren web", "tim xong");
				
			} catch (Exception e) 
			{
				Log.d("Loi", "Loi cmnr");
			}
			
		}		
		
		//gui du lieu ve
		
		broadcastIntent.putExtras(b);
		getBaseContext().sendBroadcast(broadcastIntent);
		
		
	}
	
	

}